<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<style type="text/css">
.pageFormContent p {
	width: 600px;
}

.req {
	color: red;
}
</style>
<!--修改学校页面 -->
<div class="pageContent">
	<form method="post"
		action="school_edit.action" 
		class="pageForm required-validate" 
		onsubmit="return validateCallback(this,navTabAjaxDone)">
		<input type="hidden" name="sclId" value="${sclId }">
		<input type="hidden" name="schoolRelation.sclRelId" value="${schoolRelation.sclRelId }">
		<div class="pageFormContent nowrap" layoutH="56">
			<fieldset>
				<legend>基本信息</legend>
			
				<p>
					<label>学校名称</label> 
					<input type="text"  name="sclName" class="required"	type="text" value="${sclName }" nullmsg="学校名称不能为空" datatype="*" sucmsg="&nbsp;" />
					<span class="info"></span>
				</p>
				<%-- <p>
					<label>所属地区</label> 
					<select name="areaCode" class="required combox" 
					nullmsg="所属地区" datatype="s" sucmsg="&nbsp;"
					onchange="javascript:select_scl_edit_area_change(this);"
					ref="scl_edit_osu_mobuser_list"
					refUrl="outsideUser_getSimpleByAreaCode.action?areaCode={value}&osuType=1"
					>
						<option value="">---请选择---</option>
						<c:forEach items="${application.areaList }" var="area">
							<option ${areaCode==area.areaCode?"selected":"" } value="${area.areaCode}">${area.areaName}</option>
						</c:forEach>
					</select>
				</p> --%>
				<p>
					<label>学校地址</label> 
					<input name="sclAddr" type="text" value="${sclAddr }" />
				</p>
				<p>
				<label>所属市：</label>
				<select
					name="areaCode" 
					class="required combox" id="edit_areaCode" ref="school_edit_area_county" refUrl="school_getAreaByCity.action?areaCode={value}">
					<option value="">---所有地区---</option>
					<c:forEach items="${application.areaList}" var="area">
						<option ${areaCode==area.areaCode?"selected":""}  value="${area.areaCode }">${area.areaName}</option>
					</c:forEach>
				</select>
			</p>
			<p>
				<label>所属县区：</label>
				<select
					name="countyCode" 
					class="required combox" id="school_edit_area_county" onchange="select_scl_edit_area_change(this)"
					ref="scl_edit_osu_mobuser_list"
					refUrl="outsideUser_getSimpleByAreaCode.action?areaCode={value}&osuType=1">
					<option value="">---所有县区---</option>
					<c:forEach items="${countyList}" var="area">
						<option ${countyCode==area.areaCode?"selected":""}  value="${area.areaCode }">${area.areaName}</option>
					</c:forEach>
				</select>
			</p>
				<p>
					<label>联系电话</label> 
					<input class="phone" name="sclPhone" type="text" value="${sclPhone }" /> 
					<span class="info">&nbsp;&nbsp;区号-尾号/手机号码</span>
				</p>
				
				<p>
					<label>学校联络人姓名</label> 
					<input name="sclLeaderName" type="text"	value="${sclLeaderName }" />
				</p>
				<p>
					<label>学校联络人电话</label> 
					<input class="phone" name="sclLeaderPhone"	class="required" type="text" value="${sclLeaderPhone }" />
					<span class="info">&nbsp;&nbsp;区号-尾号/手机号码</span>
				</p>
				<p>
					<label>学校简介：</label>
					<textarea name="sclSummary" rows="2" cols="30">${sclSummary}</textarea>
				</p>
				<p></p>
				<p></p>
				<p></p>
			</fieldset>
			
			<fieldset>
				<legend>扩展信息</legend>
				<p>
					<label>移动客户经理</label> 
					<select name="schoolRelation.mobManagerId" class="required combox"
					id="scl_edit_osu_mobuser_list"
					>
						<option value="">---请选择---</option>
						<c:forEach items="${mobManagerList}" var="mobManager">
							<option ${schoolRelation.mobManagerId ==mobManager.osuId ?"selected":"" } value="${mobManager.osuId }">${mobManager.osuName }-${fn:substring(mobManager.osuPhone,fn:length(mobManager.osuPhone)-4,fn:length(mobManager.osuPhone))}</option>
						</c:forEach>
					</select>
					<span class="info"><span class="req">*</span>姓名+手机号码后四位</span>
				</p>
				<p>
					<label>学校管理人员</label> <select name="schoolRelation.sclManagerId"
						id="scl_edit_osu_mgr_list"
						class="combox">
						<option value="">---请选择---</option>
						<c:forEach items="${sclManagerList}" var="sclManager">
							<option ${schoolRelation.sclManagerId ==sclManager.osuId ?"selected":"" } value="${sclManager.osuId }">${sclManager.osuName }-${fn:substring(sclManager.osuPhone,fn:length(sclManager.osuPhone)-4,fn:length(sclManager.osuPhone))}</option>
						</c:forEach>
					</select>
					<span class="info">&nbsp;姓名+手机号码后四位</span>
					
				</p>
				<p>
					<label>拓展人员</label><select name="schoolRelation.saleUserId"
						class="required combox">
						<option value="">---请选择---</option>
						<c:forEach items="${saleList}" var="saleUser">
							<option ${schoolRelation.saleUserId ==saleUser.isuId ?"selected":"" } value="${saleUser.isuId }">${saleUser.isuName }</option>
						</c:forEach>
					</select>
					<span class="req">*</span>
				</p>
				<%-- <p>
					<label>客服人员</label> <select name="schoolRelation.csUserId"
						class="combox">
						<option value="">---请选择---</option>
						<c:forEach items="${customServiceList}" var="csUser">
							<option ${schoolRelation.csUserId ==csUser.isuId ?"selected":"" }  value="${csUser.isuId }">${csUser.isuName }</option>
						</c:forEach>
					</select>
				</p> --%>
				<p>
					<label>维护人员</label> <select name="schoolRelation.saleKeepId"
						class="combox">
						<option value="">---请选择---</option>
						<c:forEach items="${maintainList}" var="maintainUser">
							<option  ${schoolRelation.saleKeepId ==maintainUser.isuId ?"selected":"" } value="${maintainUser.isuId }">${maintainUser.isuName }</option>
						</c:forEach>
					</select>
				</p>
				<p>
					<label>卡类型</label>
					<select name="schoolRelation.cardTypeFlag"
						class="required combox">
						<option value="">---请选择---</option>
						<option ${schoolRelation.cardTypeFlag == "0" ?"selected":"" } value="0">M1卡</option>
						<option ${schoolRelation.cardTypeFlag == "1" ?"selected":"" } value="1">射频卡</option>
					</select><span class="info"></span>
					<span class="req">*</span>
				</p>
				<p>
					<label>发卡方</label>
					<select name="schoolRelation.cardIssusrFlag"
						class="required combox">
						<option value="">---请选择---</option>
						<option ${schoolRelation.cardIssusrFlag == "0" ?"selected":"" } value="0">第三方</option>
						<option ${schoolRelation.cardIssusrFlag == "1" ?"selected":"" } value="1">我方</option>
					</select>
					<span class="req">*</span>
				</p>
				<p>
					<label>结算方式</label>
					<select name="schoolRelation.balanceTypeFlag"
						class="required combox">
						<option value="">---请选择---</option>
						<c:forEach items="${blanceTypeList }" var="blance">
							<option ${schoolRelation.balanceTypeFlag==blance.dicCode?"selected":"" } value="${blance.dicCode}">${blance.dicName}</option>
						</c:forEach>
					</select>
					<span class="req">*</span>
				</p>
				<p>
					<label>激励方式</label> 
					<select
						name="schoolRelation.marketingTypeFlag" class="required combox"
						id="marketingTypeFlag"  onchange="scl_edit_mktf_change()">
						<option value="">---请选择---</option>
						<c:forEach items="${marketingTypeList }" var="marketing">
							<option ${schoolRelation.marketingTypeFlag==marketing.dicCode?"selected":"" } value="${marketing.dicCode}">${marketing.dicName}</option>
						</c:forEach>
					</select>
					<span class="req">*</span>
					<!-- 
					<span class="req">*</span>
					 -->
				</p>
				<p>
					<label>备注：</label>
					<textarea id="marketingContent" name="schoolRelation.remark" rows="2" cols="25">${schoolRelation.remark}</textarea>
				</p>
				<p></p>
				<p></p>
			</fieldset>
			<%--
			
			<dl>
				<dt>发卡方：</dt>
				<dd>
					<select class="combox" name="hsSchoolRelation.cardIssusrFlag" id="cardIssusrFlag" >
						  <option value="0" <c:if test="${hsSchoolRelation.cardIssusrFlag=='0'}">selected</c:if>>第三方</option>
						  <option value="1" <c:if test="${hsSchoolRelation.cardIssusrFlag=='1'}">selected</c:if>>我公司</option>
		              </select>
					<span class="info">如果是我公司发卡，该卡会被加密，第三方卡不会被加密</span>
				</dd>
			</dl>
			<dl>
				<dt>卡预留扇区号：</dt>
				<dd>
					<select class="combox" name="hsSchoolInfo.cardReservedArea" id="reservedArea">
							<c:forEach var="i" begin="0" end="15" step="1">
							      <option value='${i}' <c:if test="${i==hsSchoolInfo.cardReservedArea}">selected</c:if>>${i}</option>
							</c:forEach>
		              </select>
					<span class="info">卡预留扇区不会被加密，供其他厂商使用，默认为15扇区</span>
				</dd>
			</dl>
			<dl>
				<dt>射频卡：</dt>
				<dd>
					 <select class="combox" name="hsSchoolRelation.cardTypeFlag" id="cardTypeFlag" nullmsg="请选择射频卡" datatype="s"  sucmsg="&nbsp;">
						  <option value="0" <c:if test="${hsSchoolRelation.cardTypeFlag=='0'}">selected</c:if>>否</option>
						  <option value="1" <c:if test="${hsSchoolRelation.cardTypeFlag=='1'}">selected</c:if>>是</option>
		              </select>
					<span class="info"></span>
				</dd>
			</dl>
			<dl>
				<dt>销售人员：</dt>
				<dd>
					<input type="text" name="saleName" id="saleName" disabled class="required" value="${sale.isuName }"/>
					<span class="info">本学校由哪个销售人员负责</span>
				</dd>
			</dl>
			<dl>
				<dt>移动客户经理：</dt>
				<dd>
		              <input type="text" name="saleName" id="saleName" disabled class="required" value="${sale.isuName }-${fn:substring(sale.isuPhone,fn:length(sale.isuPhone)-4,fn:length(sale.isuPhone))}"/>
					<span class="info">姓名+手机号码后4位</span>
				</dd>
			</dl>
			<dl>
				<dt>激励方式：</dt>
				<dd>
					<select class="combox required" name="hsSchoolRelation.marketingTypeFlag" id="marketingTypeFlag" nullmsg="请选择激励方式" datatype="s"  sucmsg="&nbsp;" onchange="change()">
			                      <option value="">--请选择--</option>
				                  <c:forEach items="${marketingTypeFlagList}" var="dic">
				       					<option value="${dic.dicCode}" <c:if test="${hsSchoolRelation.marketingTypeFlag eq dic.dicCode}">selected</c:if>>${dic.dicName }</option>
				       			  </c:forEach>
			         </select>
					<span class="info"></span>
				</dd>
			</dl>
			<dl>
				<dt>结算方式：</dt>
				<dd>
					 <select class="combox required"  name="hsSchoolRelation.balanceTypeFlag" id="balanceTypeFlag" nullmsg="请选择结算方式" datatype="s"  sucmsg="&nbsp;" 
					 <c:if test="${hsSchoolInfo.checkStatusFlag=='1'}">readonly</c:if>>
			                      <option value="">--请选择--</option>
				                  <c:forEach items="${balanceTypeFlagList}" var="dic">
				       					<option value="${dic.dicCode}" <c:if test="${hsSchoolRelation.balanceTypeFlag eq dic.dicCode}">selected</c:if>
				       					  
				       					>${dic.dicName }</option>
				       			  </c:forEach>
			         </select>
					<span class="info"></span>
				</dd>
			</dl>
			<dl>
				<dt>审核状态：</dt>
				<dd>
				    <input type="hidden" id="checkStatusFlag" value="${hsSchoolInfo.checkStatusFlag}"/>
					<c:if test="${hsSchoolInfo.checkStatusFlag==1}"><span style="color:green">已审核</span></c:if>
			        <c:if test="${hsSchoolInfo.checkStatusFlag==0}"><span style="color:red">未审核</span></c:if>
					<span style="color:#7F7F7F">已审核的学校只允许总经办修改激励方式和结算方式</span>
				</dd>
			</dl>
			<dl id="div1">
				<dt>其它类激励方式详述：</dt>
				<dd>
				    <textarea name="hsSchoolRelation.marketingContent" class="textInput" id="marketingContent"   cols="20" rows="4" 
		              datatype="otherRewardType" nullmsg="详述不能为空" 
		              errormsg="其它类激励方式详述不能少于30个汉字" sucmsg="&nbsp;">${hsSchoolRelation.marketingContent}</textarea>
		              <span class="info"></span>
		              <span style="color:#7F7F7F">如果激励方式选择“其它”，则此选项不能为空且不能少于30</span>
				</dd>
			</dl>
			 --%>
			<%-- <div class="control-group">
		          <label class="control-label" for="hsSclintroduction">其它类激励方式详述：</label>
		          <div class="controls">
		              <textarea name="schoolRelation.checkStatusFlagcheckStatusFlag" id="hsSclintroduction"  class="span5" rows="5" 
		              datatype="otherRewardType" nullmsg="详述不能为空" 
		              errormsg="其它类激励方式详述不能少于30个汉字" sucmsg="&nbsp;">${schoolRelation.checkStatusFlag}</textarea>
		              <span class="Validform_checktip"></span>
		              <p class="help-block">如果激励方式选择“其它”，则此选项不能为空<br/>并且详述不能少于30个汉字</p>
		          </div>
			</div> --%>
			<!-- <div class="divider"></div> -->
			
		</div>
		<div class="formBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit" >修改</button></div></div></li>
				<li><div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div></li>
			</ul>
		</div>
	</form>
	
</div>
<script type="text/javascript">
	function scl_edit_mktf_change(){
		var marketingTypeFlag=document.getElementById("marketingTypeFlag");
		var marketingContent=document.getElementById("marketingContent");
		if(marketingTypeFlag.value=='3'){
			marketingContent.className="required";
			marketingContent.setAttribute("minLength","30");
		}else{
			marketingContent.className="textInput";
		}
	}
	
	// 地区下拉列表变动事件  dwz级联控制移动客户经理选择 ，该事件控制学校管理员选择
	function select_scl_edit_area_change(obj){
		$.post("outsideUser_getSimpleByAreaCode.action",{
			"areaCode" : obj.value,
			"osuType" : 0
		},function(data){
			var html = '';
			for (var i = 0; i < data.length; i++) {
				html += '<option value="'+data[i][0]+'">' + data[i][1]
						+ '</option>';
			}
			var $ref = $("#scl_edit_osu_mgr_list", navTab.getCurrentPanel());
			var $refCombox = $ref.parents("div.combox:first");
			$ref.html(html).insertAfter($refCombox);
			$refCombox.remove();
			$ref.combox();
			
			
			/* 此处许完善回显
			var $mobref = $("#scl_edit_osu_mobuser_list", navTab.getCurrentPanel());
			if(obj.value=="${areaCode}"){
				$mobref.val("${schoolRelation.mobManagerId}");
			}*/
			
		}, "json");
	}
</script>
